package com.tv.cms.api.config;

import com.tv.cms.api.ApiController;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * TODO
 *
 * @author
 * @date
 **/
@Configuration
public class MyWebConfig implements WebMvcConfigurer {
    /**
     * 全部配置
     * @param configurer
     */
//    @Override
//    public void configurePathMatch(PathMatchConfigurer configurer) {
//        configurer.addPathPrefix("/api", c -> true);
//    }

    /**
     * 局部配置（只修改部分）
     * @param configurer
     */
    @Override
    public void configurePathMatch(PathMatchConfigurer configurer) {
        configurer.addPathPrefix("/api", cls -> cls.isAnnotationPresent(ApiController.class));
    }
}
